import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';

showBasicAlertDialog(BuildContext context) {

  final spinkit =  SpinKitCubeGrid(size: 51.0, color: Colors.green);

  // Create button
  Widget okButton = MaterialButton(
    color: Colors.green.shade900,
    child: const Text(
      "返回",
      style: TextStyle(color: Colors.white),
    ),
    onPressed: () {
      Navigator.of(context).pop();
    },
  );

  // Create AlertDialog
  AlertDialog alert = AlertDialog(
    title: const Text("正在努力工作..."),
    content: spinkit,
    actions: [
      okButton,
    ],
  );

  // show the dialog
  showDialog(
    context: context,
    barrierDismissible: false,
    builder: (BuildContext context) {
      return alert;
    },
  );
}

closeBasicDialog(BuildContext contex){
  Navigator.of(contex).pop();
}
